﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.IO;

namespace CodeBuilder
{
    public  class LogUtil
    {

        public static void Write(string msg)
        {
          
            string path = Environment.CurrentDirectory + string.Format(@"\CodeGenerate.Addin.Error\{0}.log", DateTime.Now.ToString("yyyy-MM-dd"));
            if(!Directory.Exists(Path.GetDirectoryName(path)))
            {
                Directory.CreateDirectory(Path.GetDirectoryName(path));
            }

            using (StreamWriter sw = new StreamWriter(path, true, Encoding.Default))
            {
                sw.WriteLine(string.Format("{0}:  {1}",DateTime.Now,msg));
                sw.Write(Environment.NewLine);
            }
        }
    }
}
